from dataclasses import dataclass 
from functools import lru_cache 
import tomllib 
from pathlib import Path 


config_file = Path(__file__).parents[1] /'config.toml'
with open(config_file, 'rb') as fp: 
    data = tomllib.load(fp)


@dataclass()
class Settings(): 
    conn_str: str = data['conn_str']
    root_dir: str = data['root_dir']
    sub_dir: str = data['sub_dir']
    
    find_dir: str = data['alter_dir']
    create_root_dir_name: str = data['create_root_dir_name']
    sql: str = data['sql']
    format: str = data['logging']['format']

@lru_cache() 
def get_settings(): 
    
    return Settings()


